﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using STT.Layer.Connection;
using STT.Admin;
using System.Data;
using STT.Business;
namespace STT.Profile.UserControlsHV
{
    public partial class UcQuanLyNhanVien : System.Web.UI.UserControl
    {
        ToolBox tb = new ToolBox();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { 
                  LoadDDLKhoahoc();
            }
        }
        private void LoadDDLKhoahoc()
        {
            Methods.KhoaHocByDonVi(ref ddlkhoahoc,"4");
        }
        protected void gvNhanvien_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {

        }

        protected void gvNhanvien_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {

        }
        private void LoadDiemNhanVien(string khoahoc)
        {
            DataTable dthv = tb.GetDataTableById2("Get_HocVien_ByMaHV", Session["Mahv"].ToString());
            DataTable dt = tb.GetDataTableById4("TbBangDiem_ByNhanVien", Session["Mahv"].ToString(),khoahoc,dthv.Rows[0]["MaKhoaHoc"].ToString());
            if (dt.Rows.Count > 0)
            {
                gvNhanvien.DataSource = dt;
                gvNhanvien.DataBind();
                thongbao.Visible = false;
                dsnhanvien.Visible = true;
            }
            else
            {
                thongbao.Visible = true;
                dsnhanvien.Visible = false;
            }
        }

        protected void ddlkhoahoc_SelectedIndexChanged(object sender, EventArgs e)
        {
            LoadDiemNhanVien(ddlkhoahoc.SelectedValue.ToString());
        }
    }
}